package com.example.mapper;

import com.example.pojo.Clazz;
import com.example.pojo.ClazzQueryParam;
import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

@Mapper
public interface ClazzMapper
{
//    @Select("select clazz.* emp.name from clazz order by update_time")
    List<Clazz> list(ClazzQueryParam clazzQueryParam);

    @Insert("insert into clazz(name,room,begin_date,end_date,master_id,subject,create_time,update_time) " +
            "values(#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime})")
    void add(Clazz clazz);
@Select("select id,name,room,begin_date,end_date,master_id,subject,create_time,update_time from clazz where id=#{id}")
    Clazz getbyid(Integer id);

    @Update("update clazz set name=#{name},room=#{room},begin_date=#{beginDate},end_date=#{endDate}," +
            "master_id=#{masterId},subject=#{subject},create_time=#{createTime},update_time=#{updateTime} where id=#{id}")
    void updateclazz(Clazz clazz);
    @Delete("delete from clazz where id=#{id}")
    void delete(Integer id);

    @Select("select * from clazz")
    List<Clazz> findall();
}
